#!/bin/bash

# 检查是否安装了curl
if ! command -v curl &> /dev/null; then
    echo "The system does not support"
    exit 1
fi

# 函数用于获取IPv6地址
get_ipv6() {
    local ipv6_address=$(curl -s 6.ipw.cn)
    if [ -z "$ipv6_address" ]; then
        echo "No public IPv6"
    else
        echo "The public IPv6 is：$ipv6_address"
    fi
}

# 函数用于获取IPv4地址
get_ipv4() {
    local ipv4_address=$(curl -s 4.ipw.cn)
    if [ -z "$ipv4_address" ]; then
        echo "No IPv4"
    else
        echo "The public IPv4 is：$ipv4_address"
    fi
}

# 主程序
get_ipv6
get_ipv4